<template>
  <div class="projectApproval flowCloumn">
    <div class="h100 w100">
      <list-table-new v-bind="tableSetting" ref="klTable"></list-table-new>
    </div>
  </div>
</template>
<script>
import { getLoginPageList } from "@/api/common.js";
export default {
  data() {
    return {
      tableSetting: {
        selectionShow: false,
        defaultSort:"inTime",
        defaultSortAsc: false,
        pageConfig: {
          pageCode: "loginLog",
          userId: this.$store.getters.userInfo.namePy,
        },
        searchObj: {
          searchMethod: (params, sortStr) => {
            if (params.date) {
              params.startTime = params.date[0];
              params.endTime = params.date[1];
            }
            this.getTableData(params, sortStr);
          },
          queryData: {
            page: 1,
            pageSize: 15,
          },
          searchArr: [
            {
              type: "userOnly",
              label: "操作人员",
              model: "createByName",
              idsStr: "createBy",
            },
            {
              type: "datetimerange",
              label: "登录时间",
              model: "date",
            },
          ],
        },
        //过滤器的值
        filterFormData: {},
        //过滤器的默认值
        defaultFilterData: {},
        userCustomData: [],
        actionList: [],
        column: [
          {
            label: "姓名",
            prop: "name",
            sortable: "custom",
          },
          {
            label: "账号",
            prop: "account",
            sortable: "custom",
          },
          {
            label: "ip",
            prop: "ip",
            sortable: "custom",
          },
          {
            label: "设备名",
            prop: "host",
            sortable: "custom",
          },
          {
            label: "登录时间",
            prop: "inTime",
            sortable: "custom",
          },
        ],
        paginationObj: {
          pageSizes: [15, 30, 50, 100],
        },
        totalNumber: 0,
        //表格方法
        tableMethods: {
          //点击行的方法
          rowClick: (row) => {},
        },
      },
    };
  },
  mounted() {
    this.$refs.klTable.getTableConfig();
    this.updateData();
  },
  methods: {
    updateData() {
      this.$refs.klTable.searchData();
    },
    // 获取表格数据
    getTableData(params, sortStr) {
      let queryData = Object.assign({}, params);
      if (sortStr.length > 0) {
        queryData.orders = sortStr;
      }
      getLoginPageList(queryData).then((res) => {
        this.$set(this.tableSetting, "tableData", res.data.list);
        this.$set(this.tableSetting, "totalNumber", res.data.total);
      });
    },
  },
};
</script>
<style lang="less" scoped>
.projectApproval {
  width: 100%;
  height: 100%;
  padding: 20px;
}
.flowCloumn {
  display: flex;
  flex-flow: column nowrap;
}
</style>
